package com.doumuxie.controller;

import com.doumuxie.annotations.CheckToken;
import com.doumuxie.common.entity.UserLoginLog;
import com.doumuxie.controller.base.BaseController;
import com.doumuxie.service.UserLoginLogService;
import com.doumuxie.util.ResultUtil;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * @author doumuxie https://gitee.com/doumuxie/
 * @version 1.0
 * @date 2020/12/1 22:07
 * @description 登录记录
 **/
@RestController
@RequestMapping("/loginLog")
@RequiredArgsConstructor
public class UserLoginLogController extends BaseController {

    final UserLoginLogService userLoginLogService;

    @GetMapping("/list")
    @CheckToken
    public ResultUtil list(HttpServletRequest request){
        String userId = getUserId(request);
        return userLoginLogService.list(userId);
    }
}
